import 'package:flutter/cupertino.dart';

class LoginProvider extends ChangeNotifier{

  bool isLogin = false;

  String username = "";

  String password = "";

  String token = "";

  String uid = "";

  String videoPath = "";

  bool isPlay = true;

  String productDetailCode = "";

  String productMaxUrl = '';

  String openId = '';

  void setOpenId(String? openid){
    if(openId != null){
      openId = openid.toString();
    }
  }

  String getOpenId(){
    return openId;
  }

  void setProductMaxUrl(String? url){
    if(url != null){
      productMaxUrl = url;
    }
  }

  String getProductMaxUrl(){
    return productMaxUrl;
  }

  void setProductDetailCode(String? code){
    if(code != null){
      productDetailCode = code;
    }
  }

  String getProductDetailCode(){
    return productDetailCode;
  }

  void setIsPlay(){
    isPlay = !isPlay;
  }

  bool getIspLay(){
    return isPlay;
  }

  void setVideoPath(String? vioPath){
    if(vioPath != null){
      videoPath = vioPath;
    }else{
      videoPath = "";
    }

  }

  String getVideoPath(){
    return videoPath;
  }

  String getUid(){
    return uid;
  }

  void setUid(String id){
    uid = id;
  }

  bool getIsLogin(){
    return isLogin;
  }

  bool setIsLogin(bool islogin){
     isLogin = islogin;
     return isLogin;
  }

  //设置用户名和密码
  void setUserName(String user){
    username = user;
    notifyListeners(); //观察者状态刷新
  }

  void setToken(String tokens){
    token = tokens;
    notifyListeners();
  }

  void setPass(String pass){
    password = pass;
    notifyListeners();
  }

  String getUserName(){
    return username;
  }

  String getToken(){
    return token;
  }


}